<template>
  <el-card>
    <tableBox :state="{lookStatus:false,editStatus:false,deleteStatus:true}"
              :table-head="tableData"
              :table-data="tableColumn"
              :isSelect="true"
              @edit="editRow"
              @delete="deleteRow"
              @look="lookRow"
              @add="addRow"
    />
  </el-card>
  <Add ref="addRoleRef" @update="add"/>
</template>
<script setup lang="ts">
import tableBox from '../../components/table/index.vue'
import Add from './component/addRole.vue'
import {ref} from 'vue'
//引入json数据
import data from './table.json'

const tableData = ref([]) as any
const tableColumn = ref([]) as any
const addRoleRef = ref()
tableData.value = data.tableHeader
tableColumn.value = data.tableData
const loading = ref(true)
setTimeout(()=>{
  loading.value =false
},5000)
const editRow =(row:any)=>{
  console.log('==========>编辑当前数据',JSON.parse(JSON.stringify(row)))
}
const deleteRow = (row:object)=>{
  console.log('-------->删除当前行数据',JSON.parse(JSON.stringify(row)))
}
const lookRow =(row:any)=>{
  console.log('==========>查看当前行的数据',JSON.parse(JSON.stringify(row)))
}
const addRow = ()=>{
  addRoleRef.value.openDialog()
}
const add = (oldRow:any)=>{
  console.log('==========>新增数据',oldRow)
}
</script>


<style scoped lang="scss">

</style>